// Listing 12.3 Constuctors and destructors called
#include <iostream>
using namespace std;

enum BREED { GOLDEN, CAIRN, DANDIE, SHETLAND,DOBERMAN, LAB };

class Mammal
{
    public:
      Mammal();
      ~Mammal();
      
      //accessors
      int GetAge() const { return itsAge;}
      void SetAge(int age) { itsAge = age;}
      int GetWeight() const { return itsWeight;}
      void SetWeight(int weight) { itsWeight  = weight;}
      
      //Other methods
      void Speak() const { cout << "Mammal sound!\n";}
      void Sleep() const { cout << "shhh, I'm sleeping!\n";}
    protected:
      int itsAge;
      int itsWeight;
};

class Dog:public Mammal
{
    public:
      Dog();
      ~Dog();

      BREED GetBreed() const { return itsBreed;}
      void SetBreed(BREED breed) { itsBreed = breed;}

      void WagTail() const { cout << "Tail wagging...\n";}
      void BegForFood() const {cout << "Begging for food...\n";}
    private:
      BREED itsBreed;
};

Mammal::Mammal():itsAge(3),itsWeight(5)
{
    std::cout << "Mammal constructor..." << '\n';
}

Mammal::~Mammal()
{
    std::cout << "Mammal destructor..." << '\n';
}

Dog::Dog():itsBreed(GOLDEN)
{
    std::cout << "Dog constructor... " << '\n';
}

Dog::~Dog()
{
    std::cout << "Dog destructor... " << '\n';
}

int main(void)
{
    Dog Fido;
    Fido.Speak();
    Fido.WagTail();

    std::cout << "Fido is " << Fido.GetAge() << " years old" << '\n';
    return 0;
}